<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%String path = request.getContextPath();%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>垫款资金流水表 管理</title>
    <style type="text/css">
    </style>
    <jsp:include page="../../import.jsp" flush="true"/>
</head>

<body class="iframeBody">
<div class="Wrapper">
    <div class="fieldset1 tabel_col tabel_col_s clearFix">
        <div class="sqPanel">
            <div class="sqPanel_head inL">
                <span>付款数据</span>
            </div>
            <div class="sqPanel_body">
                <div id="payFundGrid" class="sq-grid"></div>
            </div>
        </div>
        <div class="sqPanel">
            <div class="sqPanel_head inL">
                <span>可核销资产</span>
            </div>
            <div class="sqPanel_body">
                <div id="paySchGrid" class="sq-grid"></div>
            </div>
        </div>
        <div class="btnsBox" style="text-align: center;">
            <span id="saveBtn" class="sq-button sq-button-round l-dialog-btn-ok">保存并发送付款指令</span>
            <span id="cancelBtn" class="sq-button sq-button-round co_normal">取消</span>
        </div>
    </div>
</div>

<script type="text/javascript">
    var payFundGrid = null, paySchGrid = null;
    $(function () {
        payFundGrid = $("#payFundGrid").ligerGrid({
            url: '<%=path%>/capital/capAdvFundRvt/initRvtFundList.do',
            method: 'get',
            columns: [
                {display: '付款账号', name: 'payAccNo', minWidth: 100, align: 'left'},
                {display: '付款账户', name: 'payAccNm', minWidth: 100, align: 'left'},
                {display: '收款账户', name: 'dueAccNo', minWidth: 100, align: 'left'},
                {display: '收款户名', name: 'dueAccNm', minWidth: 100, align: 'left'},
                {display: '金额', name: 'payAmt', minWidth: 100, align: 'right',
                    render:function(rowdata,index,value){
                        return '&yen;'+FormatMoney(rowdata.payAmt/100);
                    }
                },
            ],
            pageSize: 10,
            root: 'rows',
            record: 'total',
            hideLoadButton: true,
            width: '100%',
            height: '200',
            heightDiff: -2,
            checkbox: false,
            rownumbers: true,
            allowUnSelectRow: true,
            alternatingRow: false
        });
        payFundGrid.setHeight(100);

        paySchGrid = $("#paySchGrid").ligerGrid({
            url: '<%=path%>/capital/capAdvFundRvt/initRvtPaySchList.do',
            method: 'get',
            columns: [
                {display: '支付表号', name: 'paySchNo', minWidth: 100, align: 'left'},
                {display: '期次', name: 'payPd', minWidth: 100, align: 'center'},
                {display: '垫款金额', name: 'advAmt', minWidth: 100, align: 'right',
                    render: function (rowdata, index, value) {
                        return '&yen;' + FormatMoney(rowdata.advAmt / 100);
                    }
                },
                {display: '待核销金额', name: 'advClAmt', minWidth: 100, align: 'right',
                    render: function (rowdata, index, value) {
                        return '&yen;' + FormatMoney(rowdata.advClAmt / 100);
                    }
                },
                {display: '本次核销金额', name: 'advClAmt', minWidth: 100, align: 'right',
                    render: function (rowdata, index, value) {
                        return '&yen;' + FormatMoney(rowdata.advClAmt / 100);
                    }
                },
            ],
            pageSize: 10,
            root: 'rows',
            record: 'total',
            hideLoadButton: true,
            width: '100%',
            height: '200',
            heightDiff: -2,
            checkbox: false,
            rownumbers: true,
            allowUnSelectRow: true,
            alternatingRow: false
        });
        paySchGrid.setHeight(100);

        $("#pageloading").hide();

        /* 保存并发送付款指令 */
        $("#saveBtn").click(function (event) {
            var wait_dialog;
            $.ajax({
                type: 'get',
                dataType: 'json',
                url: '<%=path%>/capital/capAdvFundRvt/batchAddRvtFund.do',
                beforeSend: function () {
                    wait_dialog = $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING, SQ_type: "waitting"});
                },
                success: function (msg) {
                    wait_dialog.close();
                    if (msg.success == 1) {
                        top.$.ligerDialog.SQalert({content: msg.info, SQ_type: "success"});
                        //回调刷新列表
                        var callback=frameElement.W2W.callback;
                        callback();
                        Remove_navTab();
                    } else {
                        top.$.ligerDialog.SQalert({content: msg.info, SQ_type: "error"});
                    }
                }
            });
        });

        /* 取消 */
        $("#cancelBtn").click(function (event) {
            //回调刷新列表
            var callback=frameElement.W2W.callback;
            callback();
            Remove_navTab();
        });

    });

</script>

</body>
</html>
